/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.herenit.beijing.dh2011.security.entity;

import java.io.Serializable;
import java.util.Date;
import java.util.List;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Obama
 */
@Entity
@Table(name = "SECURITY_ACCOUNT")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "SecurityAccount.findAll", query = "SELECT s FROM SecurityAccount s"),
    @NamedQuery(name = "SecurityAccount.findByAccountId", query = "SELECT s FROM SecurityAccount s WHERE s.accountId = :accountId"),
    @NamedQuery(name = "SecurityAccount.findByAccountName", query = "SELECT s FROM SecurityAccount s WHERE s.accountName = :accountName"),
    @NamedQuery(name = "SecurityAccount.findByPassword", query = "SELECT s FROM SecurityAccount s WHERE s.password = :password"),
    @NamedQuery(name = "SecurityAccount.findByAccountState", query = "SELECT s FROM SecurityAccount s WHERE s.accountState = :accountState"),
    @NamedQuery(name = "SecurityAccount.findByProfileType", query = "SELECT s FROM SecurityAccount s WHERE s.profileType = :profileType"),
    @NamedQuery(name = "SecurityAccount.findByStartTime", query = "SELECT s FROM SecurityAccount s WHERE s.startTime = :startTime"),
    @NamedQuery(name = "SecurityAccount.findByCreatorName", query = "SELECT s FROM SecurityAccount s WHERE s.creatorName = :creatorName"),
    @NamedQuery(name = "SecurityAccount.findByStopTime", query = "SELECT s FROM SecurityAccount s WHERE s.stopTime = :stopTime"),
    @NamedQuery(name = "SecurityAccount.findByCreatorTime", query = "SELECT s FROM SecurityAccount s WHERE s.creatorTime = :creatorTime"),
    @NamedQuery(name = "SecurityAccount.findByUpdatorName", query = "SELECT s FROM SecurityAccount s WHERE s.updatorName = :updatorName"),
    @NamedQuery(name = "SecurityAccount.findByUpdateTime", query = "SELECT s FROM SecurityAccount s WHERE s.updateTime = :updateTime"),
    @NamedQuery(name = "SecurityAccount.findByAccountDesc", query = "SELECT s FROM SecurityAccount s WHERE s.accountDesc = :accountDesc"),
    @NamedQuery(name = "SecurityAccount.findBySgstid", query = "SELECT s FROM SecurityAccount s WHERE s.sgstid = :sgstid"),
    @NamedQuery(name = "SecurityAccount.findByXglm", query = "SELECT s FROM SecurityAccount s WHERE s.xglm = :xglm"),
    @NamedQuery(name = "SecurityAccount.findByInvalidTime", query = "SELECT s FROM SecurityAccount s WHERE s.invalidTime = :invalidTime"),
    @NamedQuery(name = "SecurityAccount.findByValidTime", query = "SELECT s FROM SecurityAccount s WHERE s.validTime = :validTime"),
    @NamedQuery(name = "SecurityAccount.findByOrgId", query = "SELECT s FROM SecurityAccount s WHERE s.orgId = :orgId"),
    @NamedQuery(name = "SecurityAccount.findByOrgCode", query = "SELECT s FROM SecurityAccount s WHERE s.orgCode = :orgCode"),
    @NamedQuery(name = "SecurityAccount.findByDepartId", query = "SELECT s FROM SecurityAccount s WHERE s.departId = :departId"),
    @NamedQuery(name = "SecurityAccount.findByDepartCode", query = "SELECT s FROM SecurityAccount s WHERE s.departCode = :departCode"),
    @NamedQuery(name = "SecurityAccount.findByEmpCode", query = "SELECT s FROM SecurityAccount s WHERE s.empCode = :empCode"),
    @NamedQuery(name = "SecurityAccount.findByDeleted", query = "SELECT s FROM SecurityAccount s WHERE s.deleted = :deleted"),
    @NamedQuery(name = "SecurityAccount.findByEmpId", query = "SELECT s FROM SecurityAccount s WHERE s.empId = :empId")})
public class SecurityAccount implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 32)
    @Column(name = "ACCOUNT_ID")
    private String accountId;
    @Size(max = 30)
    @Column(name = "ACCOUNT_NAME")
    private String accountName;
    @Size(max = 20)
    @Column(name = "PASSWORD")
    private String password;
    @Column(name = "ACCOUNT_STATE")
    private Short accountState;
    @Size(max = 20)
    @Column(name = "PROFILE_TYPE")
    private String profileType;
    @Column(name = "START_TIME")
    @Temporal(TemporalType.TIMESTAMP)
    private Date startTime;
    @Size(max = 50)
    @Column(name = "CREATOR_NAME")
    private String creatorName;
    @Column(name = "STOP_TIME")
    @Temporal(TemporalType.TIMESTAMP)
    private Date stopTime;
    @Column(name = "CREATOR_TIME")
    @Temporal(TemporalType.TIMESTAMP)
    private Date creatorTime;
    @Size(max = 20)
    @Column(name = "UPDATOR_NAME")
    private String updatorName;
    @Column(name = "UPDATE_TIME")
    @Temporal(TemporalType.TIMESTAMP)
    private Date updateTime;
    @Size(max = 200)
    @Column(name = "ACCOUNT_DESC")
    private String accountDesc;
    @Size(max = 32)
    @Column(name = "SGSTID")
    private String sgstid;
    @Size(max = 50)
    @Column(name = "XGLM")
    private String xglm;
    @Column(name = "INVALID_TIME")
    @Temporal(TemporalType.TIMESTAMP)
    private Date invalidTime;
    @Column(name = "VALID_TIME")
    @Temporal(TemporalType.TIMESTAMP)
    private Date validTime;
    @Size(max = 30)
    @Column(name = "ORG_ID")
    private String orgId;
    @Size(max = 30)
    @Column(name = "ORG_CODE")
    private String orgCode;
    @Size(max = 30)
    @Column(name = "DEPART_ID")
    private String departId;
    @Size(max = 30)
    @Column(name = "DEPART_CODE")
    private String departCode;
    @Size(max = 30)
    @Column(name = "EMP_CODE")
    private String empCode;
    @Column(name = "DELETED")
    private Short deleted;
    @Size(max = 30)
    @Column(name = "EMP_ID")
    private String empId;
    @OneToMany(mappedBy = "accountId")
    private List<SecurityAccountRole> securityAccountRoleList;
    @OneToMany(mappedBy = "accountId")
    private List<SecurityPermissionAccount> securityPermissionAccountList;
    @OneToMany(mappedBy = "accountId")
    private List<SecurityAccRolePermission> securityAccRolePermissionList;

    public SecurityAccount() {
    }

    public SecurityAccount(String accountId) {
        this.accountId = accountId;
    }

    public String getAccountId() {
        return accountId;
    }

    public void setAccountId(String accountId) {
        this.accountId = accountId;
    }

    public String getAccountName() {
        return accountName;
    }

    public void setAccountName(String accountName) {
        this.accountName = accountName;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public Short getAccountState() {
        return accountState;
    }

    public void setAccountState(Short accountState) {
        this.accountState = accountState;
    }

    public String getProfileType() {
        return profileType;
    }

    public void setProfileType(String profileType) {
        this.profileType = profileType;
    }

    public Date getStartTime() {
        return startTime;
    }

    public void setStartTime(Date startTime) {
        this.startTime = startTime;
    }

    public String getCreatorName() {
        return creatorName;
    }

    public void setCreatorName(String creatorName) {
        this.creatorName = creatorName;
    }

    public Date getStopTime() {
        return stopTime;
    }

    public void setStopTime(Date stopTime) {
        this.stopTime = stopTime;
    }

    public Date getCreatorTime() {
        return creatorTime;
    }

    public void setCreatorTime(Date creatorTime) {
        this.creatorTime = creatorTime;
    }

    public String getUpdatorName() {
        return updatorName;
    }

    public void setUpdatorName(String updatorName) {
        this.updatorName = updatorName;
    }

    public Date getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }

    public String getAccountDesc() {
        return accountDesc;
    }

    public void setAccountDesc(String accountDesc) {
        this.accountDesc = accountDesc;
    }

    public String getSgstid() {
        return sgstid;
    }

    public void setSgstid(String sgstid) {
        this.sgstid = sgstid;
    }

    public String getXglm() {
        return xglm;
    }

    public void setXglm(String xglm) {
        this.xglm = xglm;
    }

    public Date getInvalidTime() {
        return invalidTime;
    }

    public void setInvalidTime(Date invalidTime) {
        this.invalidTime = invalidTime;
    }

    public Date getValidTime() {
        return validTime;
    }

    public void setValidTime(Date validTime) {
        this.validTime = validTime;
    }

    public String getOrgId() {
        return orgId;
    }

    public void setOrgId(String orgId) {
        this.orgId = orgId;
    }

    public String getOrgCode() {
        return orgCode;
    }

    public void setOrgCode(String orgCode) {
        this.orgCode = orgCode;
    }

    public String getDepartId() {
        return departId;
    }

    public void setDepartId(String departId) {
        this.departId = departId;
    }

    public String getDepartCode() {
        return departCode;
    }

    public void setDepartCode(String departCode) {
        this.departCode = departCode;
    }

    public String getEmpCode() {
        return empCode;
    }

    public void setEmpCode(String empCode) {
        this.empCode = empCode;
    }

    public Short getDeleted() {
        return deleted;
    }

    public void setDeleted(Short deleted) {
        this.deleted = deleted;
    }

    public String getEmpId() {
        return empId;
    }

    public void setEmpId(String empId) {
        this.empId = empId;
    }

    @XmlTransient
    public List<SecurityAccountRole> getSecurityAccountRoleList() {
        return securityAccountRoleList;
    }

    public void setSecurityAccountRoleList(List<SecurityAccountRole> securityAccountRoleList) {
        this.securityAccountRoleList = securityAccountRoleList;
    }

    @XmlTransient
    public List<SecurityPermissionAccount> getSecurityPermissionAccountList() {
        return securityPermissionAccountList;
    }

    public void setSecurityPermissionAccountList(List<SecurityPermissionAccount> securityPermissionAccountList) {
        this.securityPermissionAccountList = securityPermissionAccountList;
    }

    @XmlTransient
    public List<SecurityAccRolePermission> getSecurityAccRolePermissionList() {
        return securityAccRolePermissionList;
    }

    public void setSecurityAccRolePermissionList(List<SecurityAccRolePermission> securityAccRolePermissionList) {
        this.securityAccRolePermissionList = securityAccRolePermissionList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (accountId != null ? accountId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof SecurityAccount)) {
            return false;
        }
        SecurityAccount other = (SecurityAccount) object;
        if ((this.accountId == null && other.accountId != null) || (this.accountId != null && !this.accountId.equals(other.accountId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.herenit.beijing.dh2011.security.SecurityAccount[ accountId=" + accountId + " ]";
    }
    
}
